Imports System
Imports System.Management
Imports System.Windows.Forms
Imports System.Drawing
Imports System.Drawing.Drawing2D


Public Class Form1
    Dim a As Integer
    Dim b As Integer
    Dim c As Integer
    Dim d As Integer
    Dim g As Integer
    Dim form2 As New Form2()
    Dim form3 As New Form3()
    Dim form4 As New Form4()
    Dim form5 As New Form5()
    Dim settings As New Settings()

    Dim str As String = "HARDWARE\DESCRIPTION\System\CentralProcessor"


    Dim wmiClass As New System.Management.ManagementClass

    Dim wmiObject As New System.Management.ManagementObject

    Dim objMOS As ManagementObjectSearcher


    Dim CPUManagemet As New ManagementClass("Win32_Processor")

    Dim CPUs As ManagementObjectCollection = CPUManagemet.GetInstances
    Dim cpuusage As Integer
    Dim ramusage As Integer
    Dim grafx As Integer

    Private _queryable As Object

    Private Property Queryable(ByVal p1 As String) As Object
        Get
            Return _queryable
        End Get
        Set(ByVal value As Object)
            _queryable = value
        End Set
    End Property







    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        'Řádky označené hvězdičkou byly přesunuty do Form1_Load pro optimalizaci.
        ProgressBar1.Value = Int((My.Computer.Info.TotalPhysicalMemory - My.Computer.Info.AvailablePhysicalMemory) / My.Computer.Info.TotalPhysicalMemory * 100) 'Zabraná RAM v progressbaru
        Label1.Text = ProgressBar1.Value & "%"

        '*Label3.Text = Int((My.Computer.Info.TotalPhysicalMemory) / 1048576) & " MB"
        Label4.Text = Int((My.Computer.Info.TotalPhysicalMemory - My.Computer.Info.AvailablePhysicalMemory) / 1048576) & " MB" 'Zabraná paměť RAM.
        '*Label9.Text = (My.Computer.Info.OSFullName)
        '*Label11.Text = (My.Computer.Info.OSVersion)
        '*Label12.Text = (My.Computer.Info.OSPlatform)
        'Label13.Text = (My.Computer.FileSystem.Drives.Count) 'Zařízení
        'Label39.Text = PerformanceCounter6.NextValue / 1000 & " GB"
        'Label15.Text = (My.Computer.Screen.Bounds.Size.Width) & "x" & (My.Computer.Screen.Bounds.Height) 'Rozlišení obrazovky
        '*Label17.Text = (My.Computer.Name)
        'Label19.Text = (My.Computer.Clock.LocalTime)

        'Aktuální frekvence procesoru. Label30.Text = PerformanceCounter2.NextValue & "MHz"
        Label32.Text = PerformanceCounter3.NextValue






        b = (My.Computer.Network.IsAvailable)
        c = ProgressBar1.Value



        If EnglishToolStripMenuItem.Checked = True Then
            If c > 90 Then
                PictureBox1.Image = PCInfor.My.Resources.Resources.delete_48
                Label24.Text = "Low RAM."
            Else
                PictureBox1.Image = PCInfor.My.Resources.Resources.check_48
                Label24.Text = "Plenty of RAM."
            End If
        Else
            If c > 90 Then
                PictureBox1.Image = PCInfor.My.Resources.Resources.delete_48
                Label24.Text = "Nedostatek RAM."
            Else
                PictureBox1.Image = PCInfor.My.Resources.Resources.check_48
                Label24.Text = "Dostatek RAM."
            End If
        End If




        Chart1.Series("CPU").Points.Clear()

        cpuusage = ProgressBar2.Value
        Chart1.Series("CPU").Points.AddY(cpuusage)


        a = ((My.Computer.Info.TotalPhysicalMemory) - (My.Computer.Info.TotalPhysicalMemory - My.Computer.Info.AvailablePhysicalMemory)) / 1048576
        Label7.Text = Int(a) & " MB"




        If EnglishToolStripMenuItem.Checked = True Then
            If b = True Then
                Label21.Text = "Connected to the network."
            Else
                Label21.Text = "Not connected to the network."
            End If
        Else
            If b = True Then
                Label21.Text = "Připojen k síti."
            Else
                Label21.Text = "Nepřipojen k síti."
            End If
        End If




        PictureBox11.Visible = False


        Dim cpu As Integer = CDec(PerformanceCounter1.NextValue.ToString())
        ProgressBar2.Value = cpu
        Label29.Text = ProgressBar2.Value & "%"

        Label27.Text = PerformanceCounter5.NextValue
        Label30.Text = PerformanceCounter2.NextValue & " MHz"


    End Sub




    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)





    End Sub
    Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs)










    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Timer1.Interval = 1000
        Dim appName As String = Process.GetCurrentProcess.ProcessName
        Dim sameProcessTotal As Integer = Process.GetProcessesByName(appName).Length
        If sameProcessTotal > 1 Then
            Timer1.Enabled = False
            MessageBox.Show("Program je již jednou spuštěn! || The program is already running!", "The program is already running!", MessageBoxButtons.OK, MessageBoxIcon.Information)
            Close()
        End If
        appName = Nothing
        sameProcessTotal = Nothing




        Me.Show()
        Me.Size = New Size(665, 635)
        form5.Show()
        Dim cpuCount As Byte = My.Computer.Registry.LocalMachine.OpenSubKey(str, False).SubKeyCount

        Label37.Text = cpuCount.ToString

        wmiClass.Path.RelativePath = "Win32_Processor"

        Label13.Text = (My.Computer.FileSystem.Drives.Count)
        Label15.Text = (My.Computer.Screen.Bounds.Size.Width) & "x" & (My.Computer.Screen.Bounds.Height)
        Label39.Text = Int(PerformanceCounter6.NextValue / 1024) & " GB"
        Label34.Text = Int(PerformanceCounter6.NextValue) & " MB"
        Label19.Text = (My.Computer.Clock.LocalTime)






        Label9.Text = (My.Computer.Info.OSFullName)
        Label11.Text = (My.Computer.Info.OSVersion)
        Label12.Text = (My.Computer.Info.OSPlatform)
        Label3.Text = Int((My.Computer.Info.TotalPhysicalMemory) / 1048576) & " MB"
        Label17.Text = (My.Computer.Name)







        For Each CPU As ManagementObject In CPUs
            Label38.Text = (CPU("Name"))

        Next

        Label23.Text = (My.Computer.Screen.BitsPerPixel) & "Bitů na pixel"



        Dim biosname = String.Empty

        Try
            Dim WmiSelect As New ManagementObjectSearcher("root\CIMV2", "SELECT * FROM Win32_BIOS")
            For Each WmiResults As ManagementObject In WmiSelect.Get()
                biosname = WmiResults.GetPropertyValue("Description").ToString
            Next

        Catch err As ManagementException
            Label42.Text = err.Message
        End Try
        Label42.Text = biosname



        Dim l2 = UInt32.MaxValue

        Try
            Dim WmiSelect As New ManagementObjectSearcher("root\CIMV2", "SELECT * FROM Win32_Processor")
            For Each WmiResults As ManagementObject In WmiSelect.Get()
                l2 = WmiResults.GetPropertyValue("L2CacheSize")
            Next

        Catch err As ManagementException
            Label44.Text = err.Message
        End Try
        Label44.Text = l2 & " KBytes"


        Dim l3 = UInt32.MaxValue

        Try
            Dim WmiSelect As New ManagementObjectSearcher("root\CIMV2", "SELECT * FROM Win32_Processor")
            For Each WmiResults As ManagementObject In WmiSelect.Get()
                l3 = WmiResults.GetPropertyValue("L3CacheSize")
            Next

        Catch err As ManagementException
            Label46.Text = err.Message
        End Try
        Label46.Text = l3 & " KBytes"




        Dim frekvencemax = UInt32.MaxValue

        Try
            Dim WmiSelect As New ManagementObjectSearcher("root\CIMV2", "SELECT * FROM Win32_Processor")
            For Each WmiResults As ManagementObject In WmiSelect.Get()
                frekvencemax = WmiResults.GetPropertyValue("MaxClockSpeed")
            Next

        Catch err As ManagementException
            Label48.Text = err.Message
        End Try
        Label48.Text = frekvencemax & " MHz"




        Dim nazevdesky = String.Empty

        Try
            Dim WmiSelect As New ManagementObjectSearcher("root\CIMV2", "SELECT * FROM Win32_BaseBoard")
            For Each WmiResults As ManagementObject In WmiSelect.Get()
                nazevdesky = WmiResults.GetPropertyValue("Product").ToString
            Next

        Catch err As ManagementException
            Label51.Text = err.Message
        End Try
        Label51.Text = nazevdesky




        Dim vyrobcedesky = String.Empty

        Try
            Dim WmiSelect As New ManagementObjectSearcher("root\CIMV2", "SELECT * FROM Win32_BaseBoard")
            For Each WmiResults As ManagementObject In WmiSelect.Get()
                vyrobcedesky = WmiResults.GetPropertyValue("Manufacturer").ToString
            Next

        Catch err As ManagementException
            Label52.Text = err.Message
        End Try
        Label52.Text = vyrobcedesky



        Dim ipaddress As System.Net.IPHostEntry = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName)




        form5.Close()



    End Sub



    Private Sub Label21_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label21.Click
        b = (My.Computer.Network.IsAvailable)

        If EnglishToolStripMenuItem.Checked = True Then
            If b = True Then
                ToolStripStatusLabel4.Text = "You are connected to the Internet or a network."
            Else
                ToolStripStatusLabel4.Text = "You are not connected to the Internet or network."
            End If
        Else

            If b = True Then
                ToolStripStatusLabel4.Text = "Jste připojen k internetu nebo síti."
            Else
                ToolStripStatusLabel4.Text = "Nejste připojen k internetu nebo k síti."
            End If
        End If

    End Sub



    Private Sub VypnoutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        End
    End Sub

    Private Sub UkončitProgramToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UkončitProgramToolStripMenuItem.Click
        End
    End Sub

    Private Sub OProgramuToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OProgramuToolStripMenuItem1.Click
        form2.ShowDialog()
    End Sub


    Private Sub PictureBox8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox8.Click
        form2.ShowDialog()
    End Sub



    Private Sub PictureBox9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox9.Click
        System.Diagnostics.Process.Start("http://www.pcinfor.g6.cz/?page_id=63?PCInfor_access")
    End Sub

    Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click

    End Sub

    Private Sub ToolStripProgressBar1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub


    Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub EnglishToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EnglishToolStripMenuItem.Click
        EnglishToolStripMenuItem.Checked = True
        ČeštinaToolStripMenuItem.Checked = False


        Label10.Text = "Operating System:"
        Label5.Text = "Total RAM"
        Label6.Text = "RAM used"
        Label8.Text = "Free RAM"
        Label14.Text = "Number of storage devices:"
        Label40.Text = "Total disk space:"
        Label16.Text = "Your desktop resolution:"
        Label18.Text = "Computer name:"
        Label20.Text = "Time and date settings on your computer:"
        Label22.Text = "Connecting to the Internet:"
        Label28.Text = "CPU Load:"
        Label35.Text = "Total cores and threads:"
        Label31.Text = "Current CPU frequency:"
        Label33.Text = "Number of running processes:"
        Label36.Text = "Number of running subprocesses:"
        form4.Label25.Text = "Updates Data (Minimum: 0,01)"
        Label41.Text = "CPU name:"
        Label43.Text = "BIOS name:"
        Label45.Text = "L3 cache size:"
        Label47.Text = "L2 cache size:"
        Label49.Text = "Max frequency:"
        Label53.Text = "Mainboard:"

        Label2.Text = "Memory"
        Label54.Text = "Processor"
        Label55.Text = "Mainboard"
        Label56.Text = "Storage devices"
        Label57.Text = "Processes"
        Label58.Text = "Computer information"

        Label23.Text = (My.Computer.Screen.BitsPerPixel) & "Bits per pixel"

        form2.Label5.Text = "Version:"
        form2.Label6.Text = "Version code:"
        form2.Label4.Text = "Pictures used from:"
        form2.Label3.Text = "The code was taken from PC-Inf."
        form2.Button1.Text = "Close"
        ToolStripStatusLabel1.Text = "Version:"
        OProgramuToolStripMenuItem1.Text = "About this program"
        UkončitProgramToolStripMenuItem.Text = "Exit Program"
        NahlásitChybuToolStripMenuItem.Text = "Report a bug (Only czech)"
        form4.Button1.Text = "Activate"
        NastavitČasAktualizaceToolStripMenuItem.Text = "Set Time Updates"
        ToolStripStatusLabel4.Text = "Selected new language: English"
        If Button2.Text = "<--- Zobrazit méně" Then
            Button2.Text = "<--- Show less"
        Else
            Button2.Text = "See More --->"
        End If

        AktualizovatVšechnaDataToolStripMenuItem.Text = "Update all data"




        If EnglishToolStripMenuItem.Checked = True Then
            If b = True Then
                Label21.Text = "Connected to the network."
            Else
                Label21.Text = "Not connected to the network."
            End If
        Else
            If b = True Then
                Label21.Text = "Připojen k síti."
            Else
                Label21.Text = "Nepřipojen k síti."
            End If
        End If




        Dim c As Integer
        c = ProgressBar1.Value
        If EnglishToolStripMenuItem.Checked = True Then
            If c > 90 Then
                PictureBox1.Image = PCInfor.My.Resources.Resources.delete_48
                Label24.Text = "Low RAM."
            Else
                PictureBox1.Image = PCInfor.My.Resources.Resources.check_48
                Label24.Text = "Plenty of RAM."
            End If
        Else
            If c > 90 Then
                PictureBox1.Image = PCInfor.My.Resources.Resources.delete_48
                Label24.Text = "Nedostatek RAM."
            Else
                PictureBox1.Image = PCInfor.My.Resources.Resources.check_48
                Label24.Text = "Dostatek RAM."
            End If
        End If
    End Sub

    Private Sub ČeštinaToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ČeštinaToolStripMenuItem.Click
        EnglishToolStripMenuItem.Checked = False
        ČeštinaToolStripMenuItem.Checked = True

        Label10.Text = "Operační systém:"
        Label5.Text = "RAM celkově"
        Label6.Text = "Využívaná RAM"
        Label8.Text = "Volná RAM"
        Label14.Text = "Počet zařízení pro ukládání dat:"
        Label40.Text = "Celkové volné místo:"
        Label16.Text = "Rozlišení pracovní plochy:"
        Label18.Text = "Název počítače:"
        Label20.Text = "Čas a datum nastavený v počítači:"
        Label22.Text = "Připojení k internetu:"
        Label28.Text = "Celkové zatížení procesoru:"
        Label35.Text = "Počet jader procesoru:"
        Label31.Text = "Aktuální frekvence procesoru:"
        Label33.Text = "Počet spuštěných procesů:"
        Label36.Text = "Počet spuštěných subprocesů:"
        form4.Label25.Text = "Aktualizace dat (Minimum: 0,01)"
        Label41.Text = "Jméno procesoru:"
        Label43.Text = "Jméno BIOSu:"
        Label45.Text = "L3 cache velikost:"
        Label47.Text = "L2 cache velikost:"
        Label49.Text = "Maximální frekvence:"
        Label53.Text = "Základní deska:"

        Label2.Text = "Paměť"
        Label54.Text = "Procesor"
        Label55.Text = "Základní deska"
        Label56.Text = "Paměťová zařízení"
        Label57.Text = "Procesy"
        Label58.Text = "Informace o počítači"

        Label23.Text = (My.Computer.Screen.BitsPerPixel) & "Bitů na pixel"

        form2.Label5.Text = "Verze programu"
        form2.Label6.Text = "Verze kódu:"
        form2.Label4.Text = "Obrázky použity z:"
        form2.Label3.Text = "Kód byl převzat z programu PC-Inf."
        form2.Button1.Text = "Zavřít"
        ToolStripStatusLabel1.Text = "Verze programu:"
        OProgramuToolStripMenuItem1.Text = "O programu"
        UkončitProgramToolStripMenuItem.Text = "Ukončit program"
        NahlásitChybuToolStripMenuItem.Text = "Nahlásit chybu"
        form4.Button1.Text = "Aktivovat"
        NastavitČasAktualizaceToolStripMenuItem.Text = "Nastavit čas aktualizace"
        ToolStripStatusLabel4.Text = "Vybrán nový jazyk: Čeština"
        If Button2.Text = "<--- Show less" Then
            Button2.Text = "<--- Zobrazit méně"
        Else
            Button2.Text = "Zobrazit více --->"
        End If

        AktualizovatVšechnaDataToolStripMenuItem.Text = "Aktualizovat všechna data"




        If EnglishToolStripMenuItem.Checked = True Then
            If b = True Then
                Label21.Text = "Connected to the network."
            Else
                Label21.Text = "Not connected to the network."
            End If
        Else
            If b = True Then
                Label21.Text = "Připojen k síti."
            Else
                Label21.Text = "Nepřipojen k síti."
            End If
        End If






        Dim c As Integer
        c = ProgressBar1.Value
        If EnglishToolStripMenuItem.Checked = True Then
            If c > 90 Then
                PictureBox1.Image = PCInfor.My.Resources.Resources.delete_48
                Label24.Text = "Low RAM."
            Else
                PictureBox1.Image = PCInfor.My.Resources.Resources.check_48
                Label24.Text = "Plenty of RAM."
            End If
        Else
            If c > 90 Then
                PictureBox1.Image = PCInfor.My.Resources.Resources.delete_48
                Label24.Text = "Nedostatek RAM."
            Else
                PictureBox1.Image = PCInfor.My.Resources.Resources.check_48
                Label24.Text = "Dostatek RAM."
            End If
        End If
    End Sub

    Private Sub Timer5_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs)







    End Sub

    Private Sub CheckBox1_CheckedChanged_1(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub ToolStripStatusLabel1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripStatusLabel1.Click

    End Sub

    Private Sub PictureBox2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox2.Click

    End Sub

    Private Sub Label38_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label38.Click
        TextBox2.Text = Label38.Text
        TextBox2.Visible = True
        Label38.Visible = False
    End Sub

    Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick

    End Sub

    Private Sub NahlásitChybuToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NahlásitChybuToolStripMenuItem.Click
        System.Diagnostics.Process.Start("http://www.pcinfor.g6.cz/?page_id=63?PCInfor_access")
    End Sub

    Private Sub Label52_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label52.Click
        TextBox3.Visible = True
        TextBox3.Text = Label52.Text & "     " & Label51.Text
    End Sub

    Private Sub Label51_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label51.Click
        TextBox3.Visible = True
        TextBox3.Text = Label52.Text & "     " & Label51.Text
    End Sub

    Private Sub Label54_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        If EnglishToolStripMenuItem.Checked = True Then
            If Me.Size = New Size(665, 635) Then
                Me.Size = New Size(1066, 635)
                Button2.Text = "<--- Show less"

            Else
                Me.Size = New Size(665, 635)
                Button2.Text = "See More --->"

            End If
        Else
            If Me.Size = New Size(665, 635) Then
                Me.Size = New Size(1066, 635)
                Button2.Text = "<--- Zobrazit méně"

            Else
                Me.Size = New Size(665, 635)
                Button2.Text = "Zobrazit více --->"

            End If
        End If
    End Sub

    Private Sub Timer3_Tick_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer3.Tick
        ToolStripStatusLabel4.Text = "OK"
        ToolStripStatusLabel4.ActiveLinkColor = Color.Green
    End Sub

    Private Sub OProgramuToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub NastavitČasAktualizaceToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NastavitČasAktualizaceToolStripMenuItem.Click
        form4.ShowDialog()
    End Sub

    Private Sub PictureBox6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox6.Click
        form4.ShowDialog()
    End Sub

    Private Sub AktualizovatVšechnaDataToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AktualizovatVšechnaDataToolStripMenuItem.Click

        If AktualizovatVšechnaDataToolStripMenuItem.Enabled = True Then

            If ČeštinaToolStripMenuItem.Checked = True Then
                AktualizovatVšechnaDataToolStripMenuItem.Text = "Aktualizuji..."
                ToolStripStatusLabel4.Text = "Aktualizuji veškerá data..."
            Else
                AktualizovatVšechnaDataToolStripMenuItem.Text = "Updating..."
                ToolStripStatusLabel4.Text = "Updating all data..."
            End If



            AktualizovatVšechnaDataToolStripMenuItem.Enabled = False
            PictureBox11.Visible = Enabled
            Dim cpuCount As Byte = My.Computer.Registry.LocalMachine.OpenSubKey(str, False).SubKeyCount

            Label37.Text = cpuCount.ToString

            wmiClass.Path.RelativePath = "Win32_Processor"

            Label13.Text = (My.Computer.FileSystem.Drives.Count)
            Label15.Text = (My.Computer.Screen.Bounds.Size.Width) & "x" & (My.Computer.Screen.Bounds.Height)
            Label39.Text = Int(PerformanceCounter6.NextValue / 1024) & " GB"
            Label34.Text = Int(PerformanceCounter6.NextValue) & " MB"
            Label19.Text = (My.Computer.Clock.LocalTime)






            Label9.Text = (My.Computer.Info.OSFullName)
            Label11.Text = (My.Computer.Info.OSVersion)
            Label12.Text = (My.Computer.Info.OSPlatform)
            Label3.Text = Int((My.Computer.Info.TotalPhysicalMemory) / 1048576) & " MB"
            Label17.Text = (My.Computer.Name)







     

            Label23.Text = (My.Computer.Screen.BitsPerPixel) & "Bitů na pixel"



            Dim biosname = String.Empty

            Try
                Dim WmiSelect As New ManagementObjectSearcher("root\CIMV2", "SELECT * FROM Win32_BIOS")
                For Each WmiResults As ManagementObject In WmiSelect.Get()
                    biosname = WmiResults.GetPropertyValue("Description").ToString
                Next

            Catch err As ManagementException
                Label42.Text = err.Message
            End Try
            Label42.Text = biosname



            Dim l2 = UInt32.MaxValue

            Try
                Dim WmiSelect As New ManagementObjectSearcher("root\CIMV2", "SELECT * FROM Win32_Processor")
                For Each WmiResults As ManagementObject In WmiSelect.Get()
                    l2 = WmiResults.GetPropertyValue("L2CacheSize")
                Next

            Catch err As ManagementException
                Label44.Text = err.Message
            End Try
            Label44.Text = l2 & " KBytes"


            Dim l3 = UInt32.MaxValue

            Try
                Dim WmiSelect As New ManagementObjectSearcher("root\CIMV2", "SELECT * FROM Win32_Processor")
                For Each WmiResults As ManagementObject In WmiSelect.Get()
                    l3 = WmiResults.GetPropertyValue("L3CacheSize")
                Next

            Catch err As ManagementException
                Label46.Text = err.Message
            End Try
            Label46.Text = l3 & " KBytes"




            Dim frekvencemax = UInt32.MaxValue

            Try
                Dim WmiSelect As New ManagementObjectSearcher("root\CIMV2", "SELECT * FROM Win32_Processor")
                For Each WmiResults As ManagementObject In WmiSelect.Get()
                    frekvencemax = WmiResults.GetPropertyValue("MaxClockSpeed")
                Next

            Catch err As ManagementException
                Label48.Text = err.Message
            End Try
            Label48.Text = frekvencemax & " MHz"




            Dim nazevdesky = String.Empty

            Try
                Dim WmiSelect As New ManagementObjectSearcher("root\CIMV2", "SELECT * FROM Win32_BaseBoard")
                For Each WmiResults As ManagementObject In WmiSelect.Get()
                    nazevdesky = WmiResults.GetPropertyValue("Product").ToString
                Next

            Catch err As ManagementException
                Label51.Text = err.Message
            End Try
            Label51.Text = nazevdesky




            Dim vyrobcedesky = String.Empty

            Try
                Dim WmiSelect As New ManagementObjectSearcher("root\CIMV2", "SELECT * FROM Win32_BaseBoard")
                For Each WmiResults As ManagementObject In WmiSelect.Get()
                    vyrobcedesky = WmiResults.GetPropertyValue("Manufacturer").ToString
                Next

            Catch err As ManagementException
                Label52.Text = err.Message
            End Try
            Label52.Text = vyrobcedesky



            Dim ipaddress As System.Net.IPHostEntry = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName)


            PictureBox11.Visible = False
            AktualizovatVšechnaDataToolStripMenuItem.Enabled = True


            If ČeštinaToolStripMenuItem.Checked = True Then
                AktualizovatVšechnaDataToolStripMenuItem.Text = "Aktualizovat všechna data"
                ToolStripStatusLabel4.Text = "OK"
            Else
                AktualizovatVšechnaDataToolStripMenuItem.Text = "Update all data"
                ToolStripStatusLabel4.Text = "OK"
            End If

            'Řádky označené hvězdičkou byly přesunuty do Form1_Load pro optimalizaci.
            ProgressBar1.Value = Int((My.Computer.Info.TotalPhysicalMemory - My.Computer.Info.AvailablePhysicalMemory) / My.Computer.Info.TotalPhysicalMemory * 100) 'Zabraná RAM v progressbaru
            Label1.Text = ProgressBar1.Value & "%"

            '*Label3.Text = Int((My.Computer.Info.TotalPhysicalMemory) / 1048576) & " MB"
            Label4.Text = Int((My.Computer.Info.TotalPhysicalMemory - My.Computer.Info.AvailablePhysicalMemory) / 1048576) & " MB" 'Zabraná paměť RAM.
            '*Label9.Text = (My.Computer.Info.OSFullName)
            '*Label11.Text = (My.Computer.Info.OSVersion)
            '*Label12.Text = (My.Computer.Info.OSPlatform)
            'Label13.Text = (My.Computer.FileSystem.Drives.Count) 'Zařízení
            'Label39.Text = PerformanceCounter6.NextValue / 1000 & " GB"
            'Label15.Text = (My.Computer.Screen.Bounds.Size.Width) & "x" & (My.Computer.Screen.Bounds.Height) 'Rozlišení obrazovky
            '*Label17.Text = (My.Computer.Name)
            'Label19.Text = (My.Computer.Clock.LocalTime)

            'Aktuální frekvence procesoru. Label30.Text = PerformanceCounter2.NextValue & "MHz"
            Label32.Text = PerformanceCounter3.NextValue






            b = (My.Computer.Network.IsAvailable)
            c = ProgressBar1.Value



            If EnglishToolStripMenuItem.Checked = True Then
                If c > 90 Then
                    PictureBox1.Image = PCInfor.My.Resources.Resources.delete_48
                    Label24.Text = "Low RAM."
                Else
                    PictureBox1.Image = PCInfor.My.Resources.Resources.check_48
                    Label24.Text = "Plenty of RAM."
                End If
            Else
                If c > 90 Then
                    PictureBox1.Image = PCInfor.My.Resources.Resources.delete_48
                    Label24.Text = "Nedostatek RAM."
                Else
                    PictureBox1.Image = PCInfor.My.Resources.Resources.check_48
                    Label24.Text = "Dostatek RAM."
                End If
            End If




            Chart1.Series("CPU").Points.Clear()

            cpuusage = ProgressBar2.Value
            Chart1.Series("CPU").Points.AddY(cpuusage)


            a = ((My.Computer.Info.TotalPhysicalMemory) - (My.Computer.Info.TotalPhysicalMemory - My.Computer.Info.AvailablePhysicalMemory)) / 1048576
            Label7.Text = Int(a) & " MB"




            If EnglishToolStripMenuItem.Checked = True Then
                If b = True Then
                    Label21.Text = "Connected to the network."
                Else
                    Label21.Text = "Not connected to the network."
                End If
            Else
                If b = True Then
                    Label21.Text = "Připojen k síti."
                Else
                    Label21.Text = "Nepřipojen k síti."
                End If
            End If




            PictureBox11.Visible = False


            Dim cpu As Integer = CDec(PerformanceCounter1.NextValue.ToString())
            ProgressBar2.Value = cpu
            Label29.Text = ProgressBar2.Value & "%"

            Label27.Text = PerformanceCounter5.NextValue
            Label30.Text = PerformanceCounter2.NextValue & " MHz"

        Else


        End If
    End Sub

    Private Sub ToolStripStatusLabel4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripStatusLabel4.Click

    End Sub

    Private Sub PictureBox11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox11.Click

    End Sub

    Private Sub Label25_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        settings.ShowDialog()
    End Sub

    
    Private Sub Label24_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label24.Click

    End Sub
End Class